<include file="public:head" />

    <div class="container">

      <h3>单一食物供能比筛选 <small><a href="{:U('tools/index')}">返回</a></small></h3>
      <p>符合健康膳食要求的单一食物，即蛋白：10%-15%，脂肪：20%-30%，碳水：55%-65%</p>
<br><br><br>
      <div class="row">
      	<div class="col-xs-12 col-md-3">
      		<volist name="list" id="vo">

      			<li><a href="javascript:void(0);" onclick="getgnb({$vo[id]})">{$vo[name]}</li>

      		</volist>
      	</div>

      	<div class="col-xs-12 col-md-9">

      		<div id="main" style="width: 100%;height:400px;"></div>

        </div>

      </div>

    </div> <!-- /container -->


<include file="public:foot" />
<script type="text/javascript">
var myChart1 = echarts.init(document.getElementById('main'));
myChart1.setOption({
    title : {
        text: '',
        x:'center'
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        left: 'left'
    },
    series : [
        {
            name: '供能比',
            type: 'pie',
            radius : '55%',
            center: ['50%', '60%'],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
});



function getgnb(fid){
	var xx = [];
	$.ajax({
        url:"{:U('tools/gnb_data')}",
        async:false,
        dataType:'json',
        type:'get',
        data:'fid='+fid,
        success:function(msg){
            var res = msg.res;
            if(msg.code == 200){
                for(var i = 0 ; i < res.dd.length; i++){
                    xx.push(res.dd[i]);
                }
                myChart1.setOption({
			        series: {
			            data: xx
			        },
			        title:{
			        	text:res.fname+'供能比'
			        }
			    });
            }
        }
    });
}

getgnb(4433); //默认第一个  手工填写下先


</script>